{extend name="iframe" /}

{block name="body"}
<div class="layui-fluid">
	<div class="layui-row layui-col-space15">
		<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list">
			<form action="{:request()->url()}" method="post" class="xn_ajax" data-type="open">
				<div class="layui-form-item">
					<label class="layui-form-label">名称</label>
					<div class="layui-input-inline">
						<input type="text" name="name" lay-verify="required" placeholder="请输入名称" autocomplete="off"
							class="layui-input" value="{$data.name}">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">图片</label>
					<div class="layui-input-block">
						{:xn_upload_one($data.image,'image')}
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">图集</label>
					<div class="layui-input-block">
						{:xn_upload_multi($data.images,'images')}
					</div>
				</div>
				<div class="layui-form-item content" id="usertype1">
					<label class="layui-form-label">商品分类</label>
					<div class="layui-input-inline">
						<select name="typeid" lay-verify="required" lay-filter="typeid">
							<option value="0">请选择</option>
							{foreach name="type" item="vo" key="k"}
							<option value="{$vo.id}" {if condition="$vo['id'] eq $data['typeid']" }selected{/if}>{$vo.name|raw}
							</option>
							{/foreach}
						</select>
					</div>
				</div>
				<div class="layui-form-item content" id="usertype1">
					<label class="layui-form-label">商品类别</label>
					<div class="layui-input-inline">
						<select name="category_id" lay-verify="required" lay-filter="category_id">
							<option value="0">请选择</option>
							{foreach name="category" item="vo" key="k"}
							<option value="{$vo.id}" {if condition="$vo['id'] eq $data['category_id']" }selected{/if}>{$vo.title|raw}
							</option>
							{/foreach}
						</select>
					</div>
				</div>
				<div class="layui-form-item content" id="usertype1">
					<label class="layui-form-label">商品学科</label>
					<div class="layui-input-inline">
						<select name="subject_id" lay-verify="required" lay-filter="subject_id">
							<option value="0">请选择</option>
							{foreach name="subject" item="vo" key="k"}
							<option value="{$vo.id}" {if condition="$vo['id'] eq $data['subject_id']" }selected{/if}>{$vo.title|raw}
							</option>
							{/foreach}
						</select>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">库存</label>
					<div class="layui-input-inline">
						<input type="number" name="number" lay-verify="required" placeholder="请输入库存" autocomplete="off"
							class="layui-input" value="{$data.number}">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">价格</label>
					<div class="layui-input-inline">
						<input type="number" name="price" lay-verify="required" placeholder="请输入价格" autocomplete="off"
							class="layui-input" value="{$data.price}">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">押金</label>
					<div class="layui-input-inline">
						<input type="number" name="deposit" lay-verify="required" placeholder="请输入押金" autocomplete="off"
							class="layui-input" value="{$data.deposit}">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">发货</label>
					<div class="layui-input-inline">
						<input type="text" name="delivery" lay-verify="required" placeholder="" autocomplete="off"
							class="layui-input" value="{$data.delivery}">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">状态</label>
					<div class="layui-input-block">
						<input type="radio" name="status" value="1" title="上架" {if condition="$data['status'] eq '1'"
							}checked{/if}>
						<input type="radio" name="status" value="2" title="下架" {if condition="$data['status'] eq '2'"
							}checked{/if}>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">首页</label>
					<div class="layui-input-block">
						<input type="radio" name="home" value="0" title="否" {if condition="$data['home'] eq '否'"
							}checked{/if}>
						<input type="radio" name="home" value="1" title="是" {if condition="$data['home'] eq '是'"
							}checked{/if}>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">详情</label>
					<div class="layui-input-block">
						<textarea name="content" id="content" style="width: 95%;">{$data.content}</textarea>
					</div>
				</div>

				<div class="layui-form-item">
					<div class="layui-input-block">
						<button type="submit" lay-submit class="layui-btn">保存</button>
						<button type="reset" class="layui-btn layui-btn-primary">重置</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>
{/block}

{block name="js"}
<!--编辑器-->
<script src="/static/admin/ueditor/ueditor.config.js"></script>
<script src="/static/admin/ueditor/ueditor.all.min.js"></script>
<script src="/static/admin/ueditor/lang/zh-cn/zh-cn.js"></script>
<script>
	var ue_content = UE.getEditor('content', {
		//简洁编辑框
		//toolbars:[['FullScreen', 'Undo','Redo','underline','strikethrough','paragraph','fontsize','Bold','blockquote', '|', 'forecolor', 'backcolor', 'insertorderedlist','simpleupload', 'insertimage','inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown','splittocells', 'splittorows', 'splittocols', 'link', 'unlink','insertcode']],
		initialFrameHeight: 300, // 设置编辑器高度
		scaleEnabled: true,
		serverUrl: "{:url('UeditorUpload/index')}"
	})
</script>
{/block}